package protocol.JT808_2011;

public class Handle808_2011JT82 implements IHandle808_2011JT {
    @Override
    public String handle(JT808_2011Cmd cmd) {
        byte subOrder = cmd.subOrder();

        switch (subOrder){
            case 0x01:
                return handle8201(cmd);
            case 0x02:
                return handle8202(cmd);
            default:
                return "808-2011:未匹配的命令字"+(cmd.readOrder());
        }
    }

    private String handle8202(JT808_2011Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("平台->终端:临时位置跟踪控制");
        builder.append("\r\n");
        builder.append("时间间隔（秒）:"+cmd.readWORD());
        builder.append("\r\n");
        builder.append("位置跟踪有效期（秒）:"+cmd.readDWORD());
        builder.append("\r\n");
        return builder.toString();
    }

    private String handle8201(JT808_2011Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("平台->终端:查询终端位置信息");
        builder.append("\r\n");
        return builder.toString();
    }

}
